import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import dayjs from "dayjs";
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '日期',
    align:"center",
    dataIndex: 'date'
   },
   {
    title: '门店ID',
    align:"center",
    dataIndex: 'storeId'
   },
   {
    title: '门店名称',
    align:"center",
    dataIndex: 'storeName'
   },
   {
    title: '城市',
    align:"center",
    dataIndex: 'city'
   },
   {
    title: '门店类型',
    align:"center",
    dataIndex: 'storeType'
   },
   {
    title: '计划ID',
    align:"center",
    dataIndex: 'planId'
   },
   {
    title: '计划名称',
    align:"center",
    dataIndex: 'planName'
   },
   {
    title: '计划类型',
    align:"center",
    dataIndex: 'planType'
   },
   {
    title: '推广产品',
    align:"center",
    dataIndex: 'popularizeProduct'
   },
   {
    title: '营销场景',
    align:"center",
    dataIndex: 'popularizeScene'
   },
   {
    title: '推广位',
    align:"center",
    dataIndex: 'popularizeLevel'
   },
   {
    title: '投放系统',
    align:"center",
    dataIndex: 'popularizeSystem'
   },
   {
    title: '资金类型',
    align:"center",
    dataIndex: 'fundsType'
   },
   {
    title: '曝光提升数',
    align:"center",
    dataIndex: 'exposeUp'
   },
   {
    title: '千次曝光成本（元）',
    align:"center",
    dataIndex: 'cost1000Expose'
   },
   {
    title: '访问提升数',
    align:"center",
    dataIndex: 'visitUp'
   },
   {
    title: '单次访问成本（元）',
    align:"center",
    dataIndex: 'cost1Visit'
   },
   {
    title: '点击率（%）',
    align:"center",
    dataIndex: 'rateClick'
   },
   {
    title: '推广消费',
    align:"center",
    dataIndex: 'pricePopularize'
   },
   {
    title: '订单提升数',
    align:"center",
    dataIndex: 'orderUp'
   },
   {
    title: '订单交易额',
    align:"center",
    dataIndex: 'orderPrice'
   },
   {
    title: '订单原价交易额',
    align:"center",
    dataIndex: 'orderOriginalPrice'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
	{
      label: "日期",
      field: 'date',
      component: 'DatePicker',
      componentProps: {
        //日期格式化，页面上显示的值
        format:'YYYY-MM-DD',
        //返回值格式化（绑定值的格式）
        valueFormat:'YYYY-MM-DD',
        //是否显示今天按钮
        showToday:true,
        //不可选择日期
        disabledDate:(currentDate)=>{
          let date = dayjs(currentDate);
          let nowDate =  dayjs(new Date());
          //当天不可选择
          if(date.isAfter(nowDate)){
            return true;
          }
          return false;
        }
      }
      //colProps: {span: 6},
 	},
   {
    label: "门店ID",
    field: 'storeId',
    component: 'Input',
    //colProps: {span: 6},
 },
{
    label: "门店名称",
    field: 'storeName',
    component: 'Input',
    //colProps: {span: 6},
 },
	{
      label: "城市",
      field: 'city',
      component: 'Input',
      //colProps: {span: 6},
 	},
	
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '日期',
    field: 'date',
    component: 'DatePicker',
    componentProps: {
      //日期格式化，页面上显示的值
      format:'YYYY-MM-DD',
      //返回值格式化（绑定值的格式）
      valueFormat:'YYYY-MM-DD',
      //是否显示今天按钮
      showToday:true,
      //不可选择日期
      disabledDate:(currentDate)=>{
        let date = dayjs(currentDate);
        let nowDate =  dayjs(new Date());
        //当天不可选择
        if(date.isAfter(nowDate)){
          return true;
        }
        return false;
      }
    }
  },
  {
    label: '门店ID',
    field: 'storeId',
    component: 'Input',
  },
  {
    label: '门店名称',
    field: 'storeName',
    component: 'Input',
  },
  {
    label: '城市',
    field: 'city',
    component: 'Input',
  },
  
  {
    label: '门店类型',
    field: 'storeType',
    component: 'Input',
  },
  {
    label: '计划ID',
    field: 'planId',
    component: 'Input',
  },
  {
    label: '计划名称',
    field: 'planName',
    component: 'Input',
  },
  {
    label: '计划类型',
    field: 'planType',
    component: 'Input',
  },
  {
    label: '推广产品',
    field: 'popularizeProduct',
    component: 'Input',
  },
  {
    label: '营销场景',
    field: 'popularizeScene',
    component: 'Input',
  },
  {
    label: '推广位',
    field: 'popularizeLevel',
    component: 'Input',
  },
  {
    label: '投放系统',
    field: 'popularizeSystem',
    component: 'Input',
  },
  {
    label: '资金类型',
    field: 'fundsType',
    component: 'Input',
  },
  {
    label: '曝光提升数',
    field: 'exposeUp',
    component: 'InputNumber',
  },
  {
    label: '千次曝光成本（元）',
    field: 'cost1000Expose',
    component: 'InputNumber',
  },
  {
    label: '访问提升数',
    field: 'visitUp',
    component: 'InputNumber',
  },
  {
    label: '单次访问成本（元）',
    field: 'cost1Visit',
    component: 'InputNumber',
  },
  {
    label: '点击率（%）',
    field: 'rateClick',
    component: 'InputNumber',
  },
  {
    label: '推广消费',
    field: 'pricePopularize',
    component: 'InputNumber',
  },
  {
    label: '订单提升数',
    field: 'orderUp',
    component: 'InputNumber',
  },
  {
    label: '订单交易额',
    field: 'orderPrice',
    component: 'InputNumber',
  },
  {
    label: '订单原价交易额',
    field: 'orderOriginalPrice',
    component: 'InputNumber',
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  date: {title: '日期',order: 0,view: 'text', type: 'string',},
  city: {title: '城市',order: 1,view: 'text', type: 'string',},
  storeId: {title: '门店ID',order: 2,view: 'text', type: 'string',},
  storeName: {title: '门店名称',order: 3,view: 'text', type: 'string',},
  storeType: {title: '门店类型',order: 4,view: 'text', type: 'string',},
  planId: {title: '计划ID',order: 5,view: 'text', type: 'string',},
  planName: {title: '计划名称',order: 6,view: 'text', type: 'string',},
  planType: {title: '计划类型',order: 7,view: 'text', type: 'string',},
  popularizeProduct: {title: '推广产品',order: 8,view: 'text', type: 'string',},
  popularizeScene: {title: '营销场景',order: 9,view: 'text', type: 'string',},
  popularizeLevel: {title: '推广位',order: 10,view: 'text', type: 'string',},
  popularizeSystem: {title: '投放系统',order: 11,view: 'text', type: 'string',},
  fundsType: {title: '资金类型',order: 12,view: 'text', type: 'string',},
  exposeUp: {title: '曝光提升数',order: 13,view: 'number', type: 'number',},
  cost1000Expose: {title: '千次曝光成本（元）',order: 14,view: 'number', type: 'number',},
  visitUp: {title: '访问提升数',order: 15,view: 'number', type: 'number',},
  cost1Visit: {title: '单次访问成本（元）',order: 16,view: 'number', type: 'number',},
  rateClick: {title: '点击率（%）',order: 17,view: 'number', type: 'number',},
  pricePopularize: {title: '推广消费',order: 18,view: 'number', type: 'number',},
  orderUp: {title: '订单提升数',order: 19,view: 'number', type: 'number',},
  orderPrice: {title: '订单交易额',order: 20,view: 'number', type: 'number',},
  orderOriginalPrice: {title: '订单原价交易额',order: 21,view: 'number', type: 'number',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}